package com.proton.carepatchtemp.database.table;


import com.proton.carepatchtemp.constant.Extras;
import com.proton.carepatchtemp.database.BaseBean;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.NotNull;
import org.greenrobot.greendao.annotation.OrderBy;
import org.greenrobot.greendao.annotation.Unique;

/**
 * Created by Api on 2016/10/8.
 */
@Entity
public class Device extends BaseBean {

    @Id(autoincrement = false)
    @NotNull
    @Unique
    private Long id;
    private String sn = "";
    private int type = Extras.DVC_TYPE_TMP;
    private String name = "";
    @NotNull
    private String btaddress = "";
    private long creator = 0;
    private String version = "";
    private String creatorname = "";
    private int battery = -1;
    @OrderBy("hint DESC")
    private String hint;
    private String shareto;

    @Generated(hash = 896712585)
    public Device(@NotNull Long id, String sn, int type, String name,
                  @NotNull String btaddress, long creator, String version, String creatorname,
                  int battery, String hint, String shareto) {
        this.id = id;
        this.sn = sn;
        this.type = type;
        this.name = name;
        this.btaddress = btaddress;
        this.creator = creator;
        this.version = version;
        this.creatorname = creatorname;
        this.battery = battery;
        this.hint = hint;
        this.shareto = shareto;
    }

    @Generated(hash = 1469582394)
    public Device() {
    }

    /**
     * {
     * "id": 1611,
     * "deviceName": "BLE_ECG",
     * "type": 2,
     * "btaddress": "24:71:89:21:95:56",
     * "hint": "11-18 15:59刚测过",
     * "shareto": null,
     * "creator": 253,
     * "creatorname": "未设置姓名"
     * }
     */

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getBtaddress() {
        return btaddress;
    }

    public void setBtaddress(String btaddress) {
        this.btaddress = btaddress;
    }

    @Override
    public boolean equals(Object obj) {
        return this.getBtaddress().hashCode() == ((Device) obj).getBtaddress().hashCode();
    }

    public String getHint() {
        return hint;
    }

    public void setHint(String hint) {
        this.hint = hint;
    }

    public String getShareto() {
        return shareto;
    }

    public void setShareto(String shareto) {
        this.shareto = shareto;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public long getCreator() {
        return this.creator;
    }

    public void setCreator(long creator) {
        this.creator = creator;
    }

    public int getBattery() {
        return this.battery;
    }

    public void setBattery(int battery) {
        this.battery = battery;
    }

    public String getCreatorname() {
        return creatorname;
    }

    public void setCreatorname(String creatorname) {
        this.creatorname = creatorname;
    }
}
